package com.yangoxix.lovegoing.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

/**
 * @program: lovegoing
 * @description: 丝袜哥的配置文件
 * @author: chenzou
 * @create: 2021-09-30 10:27
 **/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket docket(){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
//                 配置要扫描的包的相对路径👇
                .apis(RequestHandlerSelectors.basePackage("com.yangoxix.lovegoing.controller"))
//                .paths(PathSelectors.ant("/example/**"))//过滤路径
                .build()
                .groupName("chenzou项目组")
                ;
    }
    private ApiInfo apiInfo(){
        Contact contact  = new Contact("checkout", "www.baidu.com", "213156465@1235.com");
        return new ApiInfo("爱随行文档",
                "给我一瓶酒，再给我一支烟，给你给一个api文档",
                "1.0.0",
                "urn:tos",
                contact,
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList());

    }
}

